package com.xmh.ssm.other;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Value;

import com.alibaba.fastjson.JSONObject;

//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration("classpath:spring_bean.xml")
public class JsonTest {

	@Value("${username}")
	private String uname;

	@Value("${password}")
	private String pwd;

	@org.junit.Test
	public void jsonTest() {
		Map<String, Object> map = new HashMap<>();

		map.put("msg", "yes"); 

		List<Object> lkist = new ArrayList<>();

		lkist.add("sdfsfsdf");

		map.put("list", lkist);

		String jsonString = JSONObject.toJSONString(map);

		String result = jsonString.toString();

		System.out.println(result);

		Map parseObject = JSONObject.parseObject(result, Map.class);

		System.out.println(parseObject);
	}

}
